package ooday05;
public class TEST {
    public static void main(String[] args) {
        Animal[] animals=new Animal[5];
        animals[0]=new Chick("小花",2,"花");
        animals[1]=new Fish("小金",2,"金");
        animals[2]=new Dog("小黑",2,"黑");
        animals[3]=new Chick("小白",2,"白");
        animals[4]=new Chick("小棕",2,"棕");

        for (int i = 0; i < animals.length; i++) {
            animals[i].drink();
            animals[i].eat();
            System.out.println(animals[i].name);
            System.out.println(animals[i] instanceof Swim);//f
            if (animals[i] instanceof Swim){
                Swim s=(Swim) animals[i];
                s.swim();
            }
        }

    }
}
